<?php
/**
 * Created by PhpStorm.
 * User: kankan
 * Date: 2020-05-14
 * Time: 12:01
 */

namespace App\Controllers;


use App\Services\MapServices;
use Illuminate\Support\Facades\Validator;


class TestController extends Controller
{
    public function index()
    {
        $params = $this->request->all();

        $validator = Validator::make($params,
            [
                'keyword'  => 'required',
                'boundary' => 'required',
            ]
        );
        if ($validator->fails()) return response()->json(['code' => 20000, 'msg' => $validator->errors()->first(), 'data' => []]);


        $mapObj = new MapServices();
        $res    = $mapObj->search($params['keyword'], $params['boundary']);

        return $res;
    }

}